{% extends "base.html" %}
{% block breadcrumb %}
    <h3>Email Recipients</h3>
<ul class="buttons">
    <li><a href="{% url 'add_email' %}" data-icon="u"  class="button with-icon">Add email</a></li>
</ul>
{% endblock breadcrumb %}

{% block content_class %}class="data-rows"{% endblock content_class %}
{% block title %}
Notifications - Email
{% endblock %}
{% block content %}

{% if emails.count > 0 %}
<table class='alerts-table'>
    <thead>
        <td>Email</td>
        <td ></td>
    </thead>
    {% for r in emails %}
    <tr id="row-{{ r|mongo_id }}">
        
        <td>{{ r.email }}</td>
        <td class='settings-column'>
            <a class='button edit' title='Edit'  href="{% url 'edit_email' email_id=r|mongo_id %}" data-icon="K"></a>
                <a class='button delete delete_row' title='Delete' data-rowid="{{ r|mongo_id }}" data-icon="M" href="#"></a>
        </td>
    </tr>
    <div class="delete-row" id="delete-row-{{ r|mongo_id }}">
            <p>
                Are you sure you want to delete this recepient ?
            </p>
            <ul>
                <li>
                    <a href="{% url 'delete_email' email_id=r|mongo_id %}" class="button delete">Delete</a>
                </li>
                <li>
                    <a data-rowid="{{ r|mongo_id }}" href="" class="button cancel">Cancel</a>
                </li>
            </ul>
        </div>
    {% endfor %}
</table>
{% else %}
<div class="message">No recipients</div>
{% endif %}

</div> <!-- settings_content end -->

{% endblock %}
{% block js %} 
<script type="text/javascript" src='{{ STATIC_URL }}js/libs/backbone-min.js'></script>
<script type="text/javascript" src='{{ STATIC_URL }}js/delete.row.js'></script>
{% endblock %}
